package digester

import (
	"crypto/md5"
	"hash"
)

type MD5Digester struct {
	hash hash.Hash
}

func NewMD5Digester() Digester {
	return &MD5Digester{
		hash: md5.New(),
	}
}

func (d *MD5Digester) Reset() {
	d.hash.Reset()
}

func (d *MD5Digester) Update(data []byte) {
	d.hash.Write(data)
}

func (d *MD5Digester) Finalize() []byte {
	return d.hash.Sum(nil)
}
